//
//  DYZFourTableViewCell.m
//  wind
//
//  Created by dllo on 16/1/12.
//  Copyright © 2016年 李金明. All rights reserved.
//

#import "DYZFourTableViewCell.h"

@interface DYZFourTableViewCell ()

@property (nonatomic, retain) UIView *localMusicV;
@property (nonatomic, retain) UIView *downloadMusicV;
@property (nonatomic, retain) UIView *downloadMvV;
@property (nonatomic, retain) UIView *recentV;
@property (nonatomic, retain) UILabel *localMusicL;
@property (nonatomic, retain) UILabel *downloadMusicL;
@property (nonatomic, retain) UILabel *downloadMvL;
@property (nonatomic, retain) UILabel *recentL;

@end

@implementation DYZFourTableViewCell

- (void)dealloc
{
    [_localMusicV release];
    [_downloadMvV release];
    [_downloadMusicV release];
    [_recentV release];
    [_localMusicL release];
    [_downloadMvL release];
    [_downloadMusicL release];
    [_recentL release];
    [super dealloc];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createViews];
    }
    return self;
}

- (void)createViews
{
//    self.backgroundColor = [UIColor redColor];
    
    // 本地音乐
    self.localMusicV = [[UIView alloc] init];
    self.localMusicV.backgroundColor = [UIColor colorWithRed:1.000 green:0.193 blue:0.186 alpha:1.000];
    [self addSubview:self.localMusicV];
    
    UITapGestureRecognizer *localTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(localTapAction)];
    [self.localMusicV addGestureRecognizer:localTap];
    [localTap release];
    
    UILabel *localTitle = [[UILabel alloc] init];
    localTitle.text = @"本地音乐";
    localTitle.textColor = [UIColor whiteColor];
    [self.localMusicV addSubview:localTitle];
    [localTitle release];
    
    UIImageView *localImageV = [[UIImageView alloc] init];
    [localImageV setImage:[UIImage imageNamed:@"iconfont-music"]];
    [self.localMusicV addSubview:localImageV];
    [localImageV release];
    
    self.localMusicL = [[UILabel alloc] init];
    self.localMusicL.backgroundColor = [UIColor blueColor];
    [self.localMusicV addSubview:self.localMusicL];
    [_localMusicL release];
    
    [localImageV mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(@10);
        make.centerY.equalTo(self.localMusicV.mas_centerY);
        make.size.mas_equalTo(CGSizeMake(30, 30));
        
    }];
    
    [localTitle mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(localImageV.mas_right).with.offset(10);
        make.top.equalTo(self.localMusicV.mas_top).with.offset(10);
        make.right.equalTo(self.localMusicV.mas_right).with.offset(-10);
        make.bottom.equalTo(self.localMusicL.mas_top).with.offset(-5);
        
    }];
    
    [self.localMusicL mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(localTitle.mas_left);
        make.right.equalTo(localTitle.mas_right);
        make.width.equalTo(localTitle.mas_width);
        make.height.equalTo(localTitle.mas_height);
        make.bottom.equalTo(self.localMusicV.mas_bottom).with.offset(-10);
        
    }];
    
    // 歌曲下载
    self.downloadMusicV = [[UIView alloc] init];
    self.downloadMusicV.backgroundColor = [UIColor colorWithRed:1.000 green:0.193 blue:0.186 alpha:1.000];
    [self addSubview:self.downloadMusicV];
    
    UITapGestureRecognizer *downloadMusicTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(downloadMusicTapAction)];
    [self.downloadMusicV addGestureRecognizer:downloadMusicTap];
    [downloadMusicTap release];
    
    UILabel *downloadMusicTitle = [[UILabel alloc] init];
    downloadMusicTitle.text = @"歌曲下载";
    downloadMusicTitle.textColor = [UIColor whiteColor];
    [self.downloadMusicV addSubview:downloadMusicTitle];
    [downloadMusicTitle release];
    
    UIImageView *downloadMusicImageV = [[UIImageView alloc] init];
    [downloadMusicImageV setImage:[UIImage imageNamed:@"iconfont-gequbaocun"]];
    [self.downloadMusicV addSubview:downloadMusicImageV];
    [downloadMusicImageV release];
    
    self.downloadMusicL = [[UILabel alloc] init];
    self.downloadMusicL.backgroundColor = [UIColor blueColor];
    [self.downloadMusicV addSubview:self.downloadMusicL];
    [_downloadMusicL release];
    
    
    [downloadMusicImageV mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(self.downloadMusicV.mas_left).with.offset(10);
        make.centerY.equalTo(self.downloadMusicV.mas_centerY);
        make.size.mas_equalTo(CGSizeMake(30, 30));
        
    }];
    
    [downloadMusicTitle mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(downloadMusicImageV.mas_right).with.offset(10);
        make.top.equalTo(self.downloadMusicV.mas_top).with.offset(10);
        make.right.equalTo(self.downloadMusicV.mas_right).with.offset(-10);
        make.bottom.equalTo(self.downloadMusicL.mas_top).with.offset(-5);
        
    }];
    
    [self.downloadMusicL mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(downloadMusicTitle.mas_left);
        make.right.equalTo(downloadMusicTitle.mas_right);
        make.width.equalTo(downloadMusicTitle.mas_width);
        make.height.equalTo(downloadMusicTitle.mas_height);
        make.bottom.equalTo(self.downloadMusicV.mas_bottom).with.offset(-10);
        
    }];
    
    
    // MV下载
    self.downloadMvV = [[UIView alloc] init];
    self.downloadMvV.backgroundColor = [UIColor colorWithRed:1.000 green:0.193 blue:0.186 alpha:1.000];
    [self addSubview:self.downloadMvV];
    
    UITapGestureRecognizer *downloadMvTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(downloadMvTapAction)];
    [self.downloadMvV addGestureRecognizer:downloadMvTap];
    [downloadMvTap release];
    
    UILabel *downloadMvTitle = [[UILabel alloc] init];
    downloadMvTitle.text = @"MV下载";
    downloadMvTitle.textColor = [UIColor whiteColor];
    [self.downloadMvV addSubview:downloadMvTitle];
    [downloadMvTitle release];
    
    UIImageView *downloadMvImageV = [[UIImageView alloc] init];
    [downloadMvImageV setImage:[UIImage imageNamed:@"iconfont-mvxiazai"]];
    [self.downloadMvV addSubview:downloadMvImageV];
    [downloadMvImageV release];
    
    self.downloadMvL = [[UILabel alloc] init];
    self.downloadMvL.backgroundColor = [UIColor blueColor];
    [self.downloadMvV addSubview:self.downloadMvL];
    [_downloadMvL release];
    
    [downloadMvImageV mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(self.downloadMvV.mas_left).with.offset(10);
        make.centerY.equalTo(self.downloadMvV.mas_centerY);
        make.size.mas_equalTo(CGSizeMake(30, 30));
        
    }];
    
    [downloadMvTitle mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(downloadMvImageV.mas_right).with.offset(10);
        make.top.equalTo(self.downloadMvV.mas_top).with.offset(10);
        make.right.equalTo(self.downloadMvV.mas_right).with.offset(-10);
        make.bottom.equalTo(self.downloadMvL.mas_top).with.offset(-5);
        
    }];
    
    [self.downloadMvL mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(downloadMvTitle.mas_left);
        make.right.equalTo(downloadMvTitle.mas_right);
        make.width.equalTo(downloadMvTitle.mas_width);
        make.height.equalTo(downloadMvTitle.mas_height);
        make.bottom.equalTo(self.downloadMvV.mas_bottom).with.offset(-10);
        
    }];
    
    // 最近播放
    self.recentV = [[UIView alloc] init];
    self.recentV.backgroundColor = [UIColor colorWithRed:1.000 green:0.193 blue:0.186 alpha:1.000];
    [self addSubview:self.recentV];
    
    UITapGestureRecognizer *recentTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(recentTapAction)];
    [self.recentV addGestureRecognizer:recentTap];
    [recentTap release];
    
    UILabel *recentTitle = [[UILabel alloc] init];
    recentTitle.text = @"最近播放";
    recentTitle.textColor = [UIColor whiteColor];
    [self.recentV addSubview:recentTitle];
    [recentTitle release];
    
    UIImageView *recentImageV = [[UIImageView alloc] init];
    [recentImageV setImage:[UIImage imageNamed:@"iconfont-zuijinbofang"]];
    [self.recentV addSubview:recentImageV];
    [recentImageV release];
    
    self.recentL = [[UILabel alloc] init];
    self.recentL.backgroundColor = [UIColor blueColor];
    [self.recentV addSubview:self.recentL];
    [_recentL release];
    
    [recentImageV mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(self.recentV.mas_left).with.offset(10);
        make.centerY.equalTo(self.recentV.mas_centerY);
        make.size.mas_equalTo(CGSizeMake(30, 30));
        
    }];
    
    [recentTitle mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(recentImageV.mas_right).with.offset(10);
        make.top.equalTo(self.recentV.mas_top).with.offset(10);
        make.right.equalTo(self.recentV.mas_right).with.offset(-10);
        make.bottom.equalTo(self.recentL.mas_top).with.offset(-5);
        
    }];
    
    [self.recentL mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(recentTitle.mas_left);
        make.right.equalTo(recentTitle.mas_right);
        make.width.equalTo(recentTitle.mas_width);
        make.height.equalTo(recentTitle.mas_height);
        make.bottom.equalTo(self.downloadMvV.mas_bottom).with.offset(-10);
        
    }];
    
    
    [self.localMusicV mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(@12);
        make.top.mas_equalTo(@9);
        make.right.equalTo(self.downloadMusicV.mas_left).with.offset(-9);
        make.bottom.equalTo(self.downloadMvV.mas_top).with.offset(-9);
        
    }];
    
    [self.downloadMusicV mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.localMusicV);
        make.right.mas_equalTo(@-12);
        make.width.equalTo(self.localMusicV);
        make.height.equalTo(self.localMusicV);
        
    }];
    
    [self.downloadMvV mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(self.localMusicV);
        make.bottom.mas_equalTo(@-9);
        make.width.equalTo(self.localMusicV);
        make.height.equalTo(self.localMusicV);
        
    }];
    
    [self.recentV mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(self.downloadMusicV);
        make.top.equalTo(self.downloadMvV);
        make.right.equalTo(self.downloadMusicV);
        make.bottom.equalTo(self.downloadMvV);
        
    }];
    
    

}

- (void)localTapAction
{
    NSLog(@"本地音乐");
}

- (void)downloadMusicTapAction
{
    NSLog(@"歌曲下载");
}

- (void)downloadMvTapAction
{
    NSLog(@"MV下载");
}

- (void)recentTapAction
{
    NSLog(@"最近播放");
}

@end
